
package it.progettoso.utility;

import android.app.admin.DeviceAdminReceiver;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class DeviceAdminSample extends DeviceAdminReceiver {

    @Override
    public void onEnabled(Context context, Intent intent) {
        Toast.makeText(context, "Device Admin: enabled", Toast.LENGTH_SHORT).show();
    }

    @Override
    public CharSequence onDisableRequested(Context context, Intent intent) {
        Toast.makeText(context, "Device Admin: disabled", Toast.LENGTH_SHORT).show();

    	DevicePolicyManager mDPM=(DevicePolicyManager)context.getSystemService(Context.DEVICE_POLICY_SERVICE);
    	mDPM.lockNow();
        return "Premi OK per confermare";
    }
}
